<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Insert title here</title>
	<link rel="stylesheet" href="ftl/css/bootstrap.min.css">
	<script src="ftl/js/jquery/jquery.min.js"></script>
	<script src="ftl/js/jquery.validation/1.14.0/jquery.validate.min.js"></script>
	<script src="ftl/js/jquery.validation/1.14.0/messages_zh.min.js"></script>
	<style>
		input.error {
			border: 1px solid #DB7023;
		}
	</style>
</head>
<body>
<div class="container">
	<form id="editUserForm">
		<br/>
		<div class="form-group">
			<label for="carid">车辆编号</label>
			<input type="text" class="form-control" id="carid" name="carid" value="${carid}" placeholder="输入车辆编号">
		</div>
		<div class="form-group">
			<label for="initmile">发车里程</label>
			<input type="text" class="form-control" id="initmile" name="initmile" value="${initmile}" placeholder="发车里程">
		</div>
		<div class="form-group">
			<label for="initoil">发车油量</label>
			<input type="text" class="form-control" id="initoil" name="initoil" value="${initoil}" placeholder="发车油量">
		</div>
		<div class="form-group">
			<label for="noticeitem">使用事项</label>
			<input type="text" class="form-control" id="noticeitem" name="noticeitem" value="${noticeitem}" placeholder="使用事项">
		</div>
		<div class="form-group">
			<label for="usecartime">出车时间</label>
			<input type="date" class="form-control" id="usecartime" name="usecartime" value="${usercartime?string('yyyy-MM-dd')}">
		</div>
		<div class="form-group">
			<label for="predtime">预计还车时间</label>
			<input type="date" class="form-control" id="predtime" name="predtime" value="${predtime?string('yyyy-MM-dd')}" placeholder="预计还车时间">
		</div>
		<div class="form-group">
			<label for="headman">经办人员</label>
			<input type="text" class="form-control" id="headman" name="headman" value="${headman}" placeholder="经办人员">
		</div>
		<div class="form-group">
			<label for="headmobile">经办手机</label>
			<input type="text" class="form-control" id="headmobile" name="headmobile" value="${headmobile}" placeholder="经办手机">
		</div>
		<div class="form-group">
			<label for="returntime">还车时间</label>
			<input type="date"  class="form-control" id="returntime" name="returntime" value="${returntime?string('yyyy-MM-dd')}" placeholder="还车时间">
		</div>
		<div class="form-group">
			<label for="returnmile">还车里程</label>
			<input type="text" class="form-control" id="returnmile" name="returnmile" value="${returnmile}" placeholder="还车里程">
		</div>
		<div class="form-group">
			<label for="returnoil">还车油量</label>
			<input type="text" class="form-control" id="returnoil" name="returnoil" value="${returnoil}" placeholder="还车油量">
		</div>
		<div class="form-group">
			<label for="remark">备注信息</label>
			<input type="text" class="form-control" id="remark" name="remark" value="${remark}" placeholder="备注信息">
		</div>
		<div class="form-group">
			<button type="button" id="saveBtn" class="btn btn-success">确认修改</button>
			<button type="button" id="cancelBtn" class="btn btn-default">取消</button>
		</div>
	</form>
</div>
<script>

	var updateUser = function () {
		if (!check().form()) {
			return;
		}
		$.ajax({
			type: "POST",
			dataType: "json",
			url: "/selEdit",
			data: {
				recordid: '${recorid}',
				carid: $("#carid").val(),
				initmile: $("#initmile").val(),
				initoil: $("#initoil").val(),
				repairaddress: $("#noticeitem").val(),
				usecartime: $("#usecartime").val(),
				predtime1: $("#predtime").val(),
				headman: $("#headman").val(),
				headmobile: $("#headmobile").val(),
				returntime: $("#returntime").val(),
				returnmile: $("#returnmile").val(),
				returnoil: $("#returnoil").val(),
				remark: $("#remark").val(),
				addtime: $("#addtime").val()
			},
			success: function (msg) {
				$("#cancelBtn").click();
			}
		});
	}

	$("#saveBtn").click(function () {
		updateUser();
	});

	$("#cancelBtn").click(function () {
		var index = parent.layer.getFrameIndex(window.name);
		parent.getUserPageList();
		parent.layer.close(index);
	});


	function check() {
		return $("#editUserForm").validate({
			rules: {
				userName: {
					required: true
				},
				userPassword: {
					required: true
				}
			},

			messages: {
				userName: {
					required: ""
				},
				userPassword: {
					required: ""
				}
			}

		});
	}
</script>
</body>
